<?php /** @var User $CurrentUser */ ?>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container-fluid">

        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse-1">
                <span class="sr-only">导航菜单</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#"><?php echo isset($SiteName) ? $SiteName : 'YimeWebSite' ?> - 网站后台</a>
        </div>

        <div class="collapse navbar-collapse" id="admin-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="<?php echo base_url() ?>">前台首页</a></li>
                <li <?php if ($this->router->fetch_method() === 'index') echo 'class="active"'; ?>><a href="<?php echo base_url('admin'); ?>">后台首页</a></li>
                <li <?php if ($this->router->fetch_method() === 'listUser') echo 'class="active"'; ?>><a href="<?php echo base_url('admin/listUser'); ?>">用户列表</a></li>
                <li <?php if ($this->router->fetch_method() === 'listCommodity') echo 'class="active"'; ?>><a href="<?php echo base_url('admin/listCommodity'); ?>">商品列表</a></li>
                <li <?php if ($this->router->fetch_method() === 'listSchool') echo 'class="active"'; ?>><a href="<?php echo base_url('admin/listSchool'); ?>">学校列表</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo isset($CurrentUser) ? $CurrentUser->getDisplayName() : '游客' ?> <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <?php if (isset($CurrentUser) && $CurrentUser->getId() !== 0): ?>
                            <li><a href="javascript:"><?php echo $CurrentUser->getDisplayName(); ?></a></li>
                            <li><a class="signOut" href="javascript:">退出</a></li>
                        <?php else: ?>
                            <li>游客</li>
                            <li><a class="signIn" href="javascript:">登录</a></li>
                            <li><a class="signUp" href="javascript:">注册</a></li>
                        <?php endif; ?>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>